<template>
	<view class="container padding-top-sm">
		<view
			class="margin-left-sm margin-right-sm text-13 bg-white padding-left-sm padding-right-sm padding-top padding-bottom">
			<view class="text-15 text-181818 text-bold">
				基本信息
			</view>
			<view class="flex justify-start align-center margin-top">
				<view class="text-999">
					姓名
				</view>
				<view class="margin-left">
					{{detailUser.userName}}
				</view>
				<!-- <view class="color margin-left" v-if='detailUser.level==1'>
					初级技工
				</view>
				<view class="color margin-left" v-if='detailUser.level==2'>
					中级技工
				</view>
				<view class="color margin-left" v-if='detailUser.level==3'>
					高级技工
				</view> -->
			</view>
			<view class="flex justify-start align-center margin-top">
				<view class="text-999">
					身份证号
				</view>
				<view class="margin-left">
					{{detailUser.userIdCard}}
				</view>
			</view>
			<view class="flex justify-start align-center margin-top">
				<view class="text-999">
					身份证、技工证
				</view>
			</view>
			<view class="flex justify-start flex-wrap">
				<image class="radius5 margin-top-sm" :src="detailUser.carPic"
					style="background-color: #F4F4F4;width: 324rpx;height: 204rpx;">
			
				</image>
				<image class=" margin-left-sm radius5 margin-top-sm" :src="detailUser.licensePic"
					style="background-color: #F4F4F4;width: 324rpx;height: 204rpx;">
			
				</image>
			
			</view>
			
			<!-- 	<view class="flex justify-start flex-wrap">
				<view v-for="(item,index) in 3" class="radius5 margin-top-sm" :class="{'margin-left-sm':index%2!=0}"
					style="background-color: #F4F4F4;width: 324rpx;height: 204rpx;">

				</view>
			</view> -->
			
		</view>
		<view class="bg-white margin-sm padding-left-sm padding-top padding-right-sm padding-bottom">
			<view class="text-15 text-181818">
				服务信息
			</view>
			<view class="flex justify-between align-center margin-top">
				<view class="flex justify-center align-center flex-direction">
					<view class="text-20 text-bold text-221815">
						{{detailUser.credit ||0}}
					</view>
					<view class="text-11 text-999 margin-top-sm">
						信用分
					</view>
				</view>
				<view class="flex justify-center align-center flex-direction">
					<view class="text-20 text-bold text-221815">
						{{detailUser.orderServiceCount ||0}}
					</view>
					<view class="text-11 text-999 margin-top-sm">
						服务订单量
					</view>
				</view>
				<view class="flex justify-center align-center flex-direction">
					<view class="text-20 text-bold text-221815">
						{{detailUser.orderCommentCount ||0}}
					</view>
					<view class="text-11 text-999 margin-top-sm">
						评价订单量
					</view>
				</view>
				<view class="flex justify-center align-center flex-direction">
					<view class="text-20 text-bold text-221815">
						{{detailUser.explainCount || 0}}
					</view>
					<view class="text-11 text-999 margin-top-sm">
						投诉订单量
					</view>
				</view>
			</view>
		</view>
		<view class="bg-white margin-sm padding">
			<view class="text-15 text-333 text-bold">
				个人简介
			</view>
			<view class="text-sm text-666 margin-top-sm">
				{{detailUser.description || ''}}
			</view>
		
			
		</view>
		<view style="margin-bottom: 60rpx;"  class="flex bg-white padding-left-sm padding-right-sm padding-top padding-bottom justify-between align-center margin-sm text-15" v-if='detailUser.auditStatus==1'>
	         <view>审核已通过</view>
			 <view>{{detailUser.auditTime}}</view>
		</view>
		<view style="margin-bottom: 60rpx;" class="flex justify-between align-center margin-sm text-15" v-else-if="detailUser.auditStatus==2">
			<view>审核没有通过</view>
			<view>{{detailUser.auditTime}}</view>
	
		</view>
		<view class="flex justify-between align-center margin-sm text-15" v-else>
			<button class="btn solid padding bg-tr" @click="verify(2)">审核不通过</button>
			<button class="btn padding bg-color text-white" @click="verify(1)">审核通过</button>
		</view>
		
	</view>
</template>

<script>
	import {
		appConfig
	} from '@/common/js/config.js'
	export default {
		data() {
			return {
				userId: '',
				detailUser: {}
			};
		},
		onLoad(option) {
			console.log(option.item)
			if (option.item) {
				this.detailUser = JSON.parse(option.item)
				
				console.log(this.detailUser)
				// this.getDetail()
			}
		},
		methods: {
			async getDetail() {
				const [
					err,
					rs
				] = await this.$get(this.$api.detailCourier, {
					userId: this.userId
				})

				if (rs) {
					console.log(rs)
					this.detailUser = rs.data
					console.log(this.detailUser)
				}
			},
			verify(status) {
				let title = ''
				const that = this
				if (status==1) {
					title = '你确定审核通过吗'
				} else {
					title = '你确定审核不通过'
				}
				uni.showModal({
					title: '提示',
					content: title,
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
							const data = {
								auditStatus: status,
								id: that.detailUser.id,
								auditUserId: uni.getStorageSync('userId') || appConfig.userId
							}
							console.log(that.$jsonPost)
							that.$jsonPost(that.$api.auditCourier, data).then(res => {
								const [err, rs] = res
								if (rs) {
									that.$util.msg(rs.message)
									let pages = getCurrentPages()
									let prePage = pages[pages.length - 2] 
									prePage.$vm.reFreshStatus = Math.random()
									uni.navigateBack() 
								}

							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn {
		margin-top: 92rpx;
		margin-bottom: 130rpx;
		width: 346rpx;
		height: 88rpx;
	}

	.t-btn {
		padding: 18rpx 28rpx;
	}
</style>
